package com.qing.deep_in.springboot.chapter3.aspect;

import com.qing.deep_in.springboot.chapter3.aspect.bean.User;
import com.qing.deep_in.springboot.chapter3.aspect.config.AppConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author guoqf
 * @date 2022/3/25 13:47
 */
public class ApplicationContextTest {
    private static final Logger logger = LoggerFactory.getLogger(ApplicationContextTest.class);
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        User bean = context.getBean(User.class);
        logger.info(bean.getId() + ", " + bean.getName());

        User initUser = (User) context.getBean("initUser");
        logger.info(initUser.getId() + ":  " + initUser.getName());
    }
}
